package cn.csb.controller;

import cn.csb.domain.Book;
import cn.csb.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//@Controller
////@RequestMapping("/book")
@RestController
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping("/findAll.do")
    public List<Book> findAll() {

        List<Book> list = bookService.findAll();

        for (Book book : list) {
            System.out.println(book);
        }

        return list;
    }
}
